<?php
class Core_Common_Views_Helpers_LoggedInUser extends Zend_View_Helper_Abstract {
	public $view;
	
	public function setView(Zend_View_Interface $view) {
		$this->view = $view;
	}
	 
	
	public function LoggedInUser() {
		$auth = Zend_Auth::getInstance();
		if($auth->hasIdentity()) {
			//$logoutUrl = $this->view->url(array('controller'=>'auth','action'=>'logout'));
			$logoutUrl = "/default/auth/logout";
			$user = $auth->getIdentity();
			
			$username = ucfirst($user->email);
			$string = 'Logged in as '.$username.' | <a href="'.$logoutUrl.'">Log out</a>';
		}
		else {
			//$loginUrl = $this->view->url(array('controller'=>'auth','action'=>'identify'));
			$loginUrl = "/default/auth/identify";
			//$RegistrationUrl =$this->view->url(array('controller'=>'auth','action'=>'registercustomer'));
			$RegistrationUrl = "/default/auth/registercustomer";
			$string = '<a href="'.$loginUrl.'">Log in</a> | <a href="'.$RegistrationUrl.'">Register as customer</a>';
			//$RegistrationUrl =$this->view->url(array('controller'=>'auth','action'=>'registertrainer'));
			$RegistrationUrl = "/default/auth/registertrainer";
			$string =$string. ' | <a href="'.$RegistrationUrl.'">Register as Trainer</a>';
		}
		return $string;
	}
}
?>